import http from "@/utils/request"


// 密码登录

export const loginApi = (mobile: any, password: any) => http.post("http://uimall.104.brwq.xyz/api/user/pwdlogin", {
    mobile,
    password
}, {
    headers: {
        'content-type': 'application/json'
    }
})


//  注册

export const registerApi = (mobile: "", password = "", code: "") => http.post("http://uimall.104.brwq.xyz/api/user/register", {
    mobile,
    password,
    code
})

// 发送短信验证码
export const sendCodeApi = (mobile = "", event = "register") => http.post("http://uimall.104.brwq.xyz/api/user/sendcode", {
    mobile,
    event
})



// 用户信息

export const UserInfoAPi = () => http.get("http://uimall.104.brwq.xyz/api/user")


// 用户名资料编辑     
export const userEditApi = (params:any) => http.put("http://uimall.104.brwq.xyz/api/user",
    params
)




// 退出登录
export const userLogoutApi = () => http.post("http://uimall.104.brwq.xyz/api/user/logout")





// 作品列表

export const worksListApi = (per_page = 10, page = 1, title: "", industry: "", type = "", sort: "", order: "", tags: "", bg_color: "", file_type: "") => http.get("http://uimall.104.brwq.xyz/api/project", {
    params: {
        per_page,
        page,
        title,
        industry,
        type,
        sort,
        order,
        tags,
        bg_color,
        file_type
    }

})

// 作品详情页面
export const worksDetailApi = (id: any) => http.get("http://uimall.104.brwq.xyz/api/project/" + id, {
    params: {
        id
    }
})



// 属性分类
export const navListApi = () => http.get("http://uimall.104.brwq.xyz/api/categoryselect/industry")


// 文件类型分类
export const categorySelectFileApi = () => http.get("http://uimall.104.brwq.xyz/api/categoryselect/file_type")




// 设计师列表
export const designerListApi = (per_page = 10, page = 1, name: "") => http.get("http://uimall.104.brwq.xyz/api/designer", {
    params: {
        per_page,
        page,
        name
    }
})

// 设计师列表详情
export const designerDetailApi = (id: any) => http.get("http://uimall.104.brwq.xyz/api/designer/" + id, {
    params: {
        id,
    }
})



// 行业分类

export const industrySelectApi = () => http.get("http://uimall.104.brwq.xyz/api/categoryselect/industry")


// UI属性分类

export const uiSelectApi = () => http.get("http://uimall.104.brwq.xyz/api/categoryselect/ui_type")



// 评论列表

export const commentListApi = (id = "") => http.get(`http://uimall.104.brwq.xyz/api/comment?project_id= +${id}`, {
    params:
    {
        id
    }
})

// 添加评论

export const addCommentApi = (to_user_id = "", project_id = "", parent_id = "", content = "") => http.post("http://uimall.104.brwq.xyz/api/comment", {
    to_user_id,
    project_id,
    parent_id,
    content
})


// 我的收藏夹
export const myCollectFolderApi = () => http.get("http://uimall.104.brwq.xyz/api/my/collectFolder")


// 收藏夹添加
export const addCollectFoldrApi = (name = "", image = "", remark = "") => http.post("http://uimall.104.brwq.xyz/api/collectFolder", {
    name,
    image,
    remark
})


// 关注/取消关注
export const focusApi = (to_user_id: any) => http.post("http://uimall.104.brwq.xyz/api/focus", {
    to_user_id
})


// 删除收藏夹
export const delCollectFolderApi = (id: any) => http.delete(`http://uimall.104.brwq.xyz/api/collectFolder/ +${id}`, {
    params: {
        id
    }
})

// 收藏夹编辑
export const editCollectFolderApi = (name = "", image = "", remark: "", id: any) => http.put("http://uimall.104.brwq.xyz/api/collectFolder/" + id, {
    name,
    image,
    remark,
    id
})


// 收藏作品
export const collectProjectApi = (collect_folder_id = "", collect_id = "") => http.post("http://uimall.104.brwq.xyz/api/collect", {
    collect_folder_id,
    collect_id
})

// 收藏夹详情
export const collectFolderDetailsApi = (id: any) => http.get("http://uimall.104.brwq.xyz/api/collectFolder/" + id, {
    params: {
        id
    }
})

// 删除收藏
// export const delCollectApi = (collect_folder_id = "", collect_id = "") => http.delete("http://uimall.104.brwq.xyz/api/collect", {
//     collect_folder_id,
//     collect_id
// })


// 移动收藏
export const moveCollect = (collect_folder_id = "", collect_id = "", new_collect_folder_id = "") => http.put("http://uimall.104.brwq.xyz/api/collect", {
    collect_folder_id,
    collect_id,
    new_collect_folder_id
})